package com.waterdrop.wlsggk.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.waterdrop.wlsggk.mapper.MaterialInventoryMapper;
import com.waterdrop.wlsggk.pojo.MaterialInventory;
import com.waterdrop.wlsggk.service.IMaterialInventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 物料库存Service业务层处理
 *
 * @author Naruto
 * @date 2023-10-18
 */
@Service
public class MaterialInventoryServiceImpl implements IMaterialInventoryService {
    @Autowired
    private MaterialInventoryMapper materialInventoryMapper;

    /**
     * 查询物料库存
     *
     * @param id 物料库存主键
     * @return 物料库存
     */
    @Override
    public MaterialInventory selectMaterialInventoryById(Integer id) {
        return materialInventoryMapper.selectMaterialInventoryById(id);
    }

    /**
     * 查询物料库存列表
     *
     * @param materialInventory 物料库存
     * @return 物料库存
     */
    @Override
    public List<MaterialInventory> selectMaterialInventoryList(MaterialInventory materialInventory) {
        return materialInventoryMapper.selectMaterialInventoryList(materialInventory);
    }

    /**
     * 新增物料库存
     *
     * @param materialInventory 物料库存
     * @return 结果
     */
    @Override
    public int insertMaterialInventory(MaterialInventory materialInventory) {
        return materialInventoryMapper.insertMaterialInventory(materialInventory);
    }

    /**
     * 修改物料库存
     *
     * @param materialInventory 物料库存
     * @return 结果
     */
    @Override
    public int updateMaterialInventory(MaterialInventory materialInventory) {
        materialInventory.setUpdateTime(DateUtils.getNowDate());
        return materialInventoryMapper.updateMaterialInventory(materialInventory);
    }

    /**
     * 批量删除物料库存
     *
     * @param ids 需要删除的物料库存主键
     * @return 结果
     */
    @Override
    public int deleteMaterialInventoryByIds(Integer[] ids) {
        return materialInventoryMapper.deleteMaterialInventoryByIds(ids);
    }

    /**
     * 删除物料库存信息
     *
     * @param id 物料库存主键
     * @return 结果
     */
    @Override
    public int deleteMaterialInventoryById(Integer id) {
        return materialInventoryMapper.deleteMaterialInventoryById(id);
    }
}
